﻿@model Susha.Models.Pages.GuestPage

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section scripts{
    @Scripts.Render("/Scripts/common/user.js")
    @Scripts.Render("/Scripts/jquery-1.8.2.min.js")
}

<h1>Гостевая</h1>
<div id="new-comment" class="guest-container">Оставить комментарий</div>
@using(Html.BeginForm("Index", "Guest", FormMethod.Post, new {  }))
{
    <fieldset class="guest-container" id="new-comment-fieldset">
        <legend>Ваш комментарий</legend>
        @Html.TextBox("UserName", Model.NewComment.UserName, new { placeholder="Представьтесь, пожалуйста", @class="in-container" })<br />
        @Html.TextArea("UserComment", Model.NewComment.UserComment, new { placeholder="Оставьте Ваше сообщение здесь", @class="in-container" })<br />
        @Html.ValidationMessage("UserComment")<br />
        <div class="in-container">Введите слово "@Model.FalseCaptcha" без кавычек</div>
        @Html.TextBox("Captcha", Model.NewComment.Captcha, new { @class = "in-container" })<br />
        @Html.ValidationMessage("Captcha")<br />
        <button type="submit" class="btn btn-black in-container">Leave a comment</button>
    </fieldset>
}
<div class="guest-container">
@foreach(Susha.Models.GuestComment comment in Model.Comments)
{
    <div class="guest-comment">
        <b>@comment.UserName:</b> @comment.UserComment<br />
        @if(!String.IsNullOrEmpty(comment.AdminComment))
        {
            <div class="admin-comment">@comment.AdminComment</div>
        }
    </div>
} 
</div>
<div class="btn-panel">
    @if (Model.Prev)
    {
        @Html.ActionLink("Prev", "Index", "Guest", new { id = Model.PageNumber - 1 }, new { @class="btn btn-black" })
    }
    @if (Model.Next)
    {
        @Html.ActionLink("Next", "Index", "Guest", new { id = Model.PageNumber + 1 }, new { @class="btn btn-black" })
    }

</div>